package windowBuilderExample;

import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JLabel;
import java.awt.BorderLayout;
import javax.swing.JComboBox;
import javax.swing.JButton;
import javax.swing.JRadioButton;
import javax.swing.JToggleButton;
import javax.swing.JPanel;
import javax.swing.JCheckBox;
import javax.swing.JFormattedTextField;
import javax.swing.JTextPane;
import javax.swing.JTextArea;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class HelloMyTextAreaAppWindow {

	private JFrame frame;
	private JTextArea myTextArea;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					HelloMyTextAreaAppWindow window = new HelloMyTextAreaAppWindow();
					window.frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the application.
	 */
	public HelloMyTextAreaAppWindow() {
		initialize();
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {
		frame = new JFrame();
		frame.setBounds(100, 100, 450, 300);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		JToggleButton hello = new JToggleButton("Hello"); 
		hello.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				getMyTextArea().setText( "Good Morning." );
			}
		});
		frame.getContentPane().add(hello, BorderLayout.SOUTH);
		
		myTextArea = new JTextArea();
		frame.getContentPane().add(myTextArea, BorderLayout.CENTER);
	}  
	public JTextArea getMyTextArea() {
		return myTextArea;
	}
}
